
CC	=	gcc
CFLAGS	=	

LD	=	gcc
LDLIB	=	

SRCS	=	test.c
OBJS	=	${SRCS:.c=.o}

PACKAGE	=	test

SUBDIRS= lib ui util 

.PHONY : all clean $(SUBDIRS)

all : ${PACKAGE}
 	#  执行所有子目录下的makefile
#	# $(MAKE) $(SUBDIRS) TARGET=$@ 
	@echo "done!" 



${PACKAGE} : ${OBJS} $(SUBDIRS)
	${CC} -o $@ ${ALLOBJS} ${LDLIB}

# 需找所有.o文件包含进ALLOBJS
DIR = .
ALLOBJS	= ${shell find ${DIR} -name "*.o"}
   
$(SUBDIRS):print 
	$(MAKE) -C $@ $(TARGET)  
      
print:  
	@echo "print"

%.o:%.c
	${CC} ${CFLAGS} -c $<

clean:
 	#  执行所有子目录下的makefile
	$(MAKE) $(SUBDIRS) TARGET=$@
